import 'dotenv/config'
import mysql from 'mysql2/promise'

let pool

export function getPool() {
  if (!pool) {
    pool = mysql.createPool({
      host: 'localhost',
      port: Number(process.env.DB_PORT || 3306),
      user: 'root',
      password: 'xiaolu246',
      database: 'genshin',
      connectionLimit: 10,
      timezone: '+00:00'
    })
  }
  return pool
}
